package Coding.IO;

import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;

public class CopyFile {
    public static void main(String[] args) throws IOException {
        FileInputStream fileInputStream = new FileInputStream("./demo.txt");  //读
        FileOutputStream fileOutputStream = new FileOutputStream("./demo2.txt"); //写

        long start = System.currentTimeMillis();
        int data;
        while(  ( data=fileInputStream.read()) !=1){
            fileOutputStream.write(data);
        }

        long end = System.currentTimeMillis();
        fileInputStream.close();
        fileOutputStream.close();

        System.out.println("耗时" + (end - start));
    }
}
